import '@/comm.css'
// import '@/modules/corejs/em-auto'
import '@/modules/corejs/common.js'
// require('babel-polyfill')
import Vue from 'vue'
import router from './router.js'
import App from './app.vue'
import click from '@/modules/corejs/dom/click.vue'

import popup from '@/modules/popup/popup-vue'

import axios from '@/modules/ajax-api/asp.net.js'
import preloaderFull from '@/modules/preloader-full/preloader-full'
import initLoad from '@/init-load'

// setTimeout(function () {
//   import(/* webpackChunkName: "defer" */ './js/picture-zoom-popup-init') // 放大看图初始
// }, 1000)

// 开发环境
// if (process.env.NODE_ENV !== 'production') {
//   window.GLOBAL_PARAMS.userId = '455587'
// }

// 旧版 bus，等待移除
let bus = new Vue({
  data: {
    classId: null,
    cityName: undefined
    // userId: window.GLOBAL_PARAMS.userId
  }
})

// 第二版 bus
let $bus = Vue.prototype.$bus = new Vue({
  data: {
    cityName: '广东省,深圳市'
  }
})

Vue.use(popup)
Vue.prototype.$axios = axios
// Vue.use($axios)
Vue.prototype.$preloaderFull = preloaderFull
// Vue.use($preloaderFull)
Vue.use(click)
preloaderFull.show()
router.beforeEach((to, from, next) => {
  preloaderFull.show()
  // document.title = to.meta.title
  next()
})
router.afterEach(() => {
  preloaderFull.close()
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  data: {
    bus
  },
  router,
  // 根实例用可实现替换绑定的元素
  render () {
    return <App bus={bus}/>
  }
})

initLoad({ bus, router, $bus })

// router.push({name: 'temp2list'})
